import java.util.Arrays;

public class Rotate {
    public static void rotate(int[] nums, int k) {
        int n=nums.length;
        int []ret=new int[n];
        int tmp=0;
        for(int i=0;i<n;i++){
            tmp=(i+k)%n;
            ret[tmp]=nums[i];
        }
        for(int i=0;i<n;i++){
            nums[i]=ret[i];
        }
    }
    public static void main(String[] args) {
    int []nums={1,2,3,4,5,6,7};
        System.out.println(Arrays.toString(nums));
    rotate(nums,3);
        System.out.println(Arrays.toString(nums));
}
}
